package com.itcast.n9_垃圾回收;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * @program: jvm
 * @description:
 * @author: flyduck
 * @create: 2024-10-08 11:44
 **/
//-XX:+UseParNewGC  -Xms60m -Xmn20m -Xmx60m -XX:SurvivorRatio=3   -XX:+PrintGCDetails
//[GC (Allocation Failure) [ParNew: 11279K->3979K(16384K), 0.0082362 secs] 11279K->9099K(57344K), 0.0083098 secs] [Times: user=0.03 sys=0.00, real=0.01 secs]
//Using the ParNew young collector with the Serial old collector is deprecated and will likely be removed in a future release
//如果使用ParNew建议和cms搭配
public class Test18_垃圾回收器_验证加上UseParNewGC参数年轻代确实使用了ParNew垃圾收集器 {
    public static void main(String[] args) throws IOException {
        List<Object> list = new ArrayList<>();
        int count = 0;
        while (true){
            System.in.read();
            System.out.println(++count);
            //每次添加1m的数据
            list.add(new byte[1024 * 1024 * 1]);
        }
    }
}
